<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">	
</head>
<body bgcolor="ffffff" style="overflow:hidden; padding: 0px; padding-left: 0px; margin: 0px;">
<script language="javascript" type="text/javascript">

var clientId = '<?php echo session_id(); ?>';

var partitionLength = <?php echo ($partitionLength?$partitionLength:-1); ?>;
var maxFileLength = <?php echo ($maxFileLength?$maxFileLength:-1); ?>;
var ftpUrl = '<?php echo ($ftpURL?$ftpURL:""); ?>';

function appletInitialized(uploader){
	var origUrl = uploader.getUploaderConfig().getUploadUrl();
	var currentFolder = parent.base64_encode(parent.ajaxplorer.getUserSelection().getContextNode().getPath());
    uploader.getUploaderConfig().setUploadUrl(origUrl + "&dir=" + currentFolder + "&ajxp_sessid=" + clientId);
    uploader.getUploaderConfig().setResumeCheckUrl(origUrl + "&dir=" + currentFolder + "&ajxp_sessid=" + clientId);
    uploader.getUploaderConfig().setPartitionLength(partitionLength);
    uploader.getUploaderConfig().setMaxFileLength(maxFileLength);
    parent.document.fire("ajaxplorer:longtask_starting");
}

function uploaderStatusChanged(uploader){
	// 1 = uploading, 0 is back to normal => we assume "uploaded"
	if(uploader.getStatus() == 0){
		parent.ajaxplorer.fireContextRefresh();
        parent.document.fire("ajaxplorer:longtask_finished");
	}
}


/*
var messages = 
{
	MaxFileSizeLimit:252, 
	MaxFileSize:211, 
	HTTPError:253, 
	IOError:254, 
	SecurityError:255,
	Uploaded:256,
	Remove:257,
	Add:214,
	Clear:216,
	Upload:77,
	Cancel:232,
	TotalFile:258,
	SizeText:259,
	Byte:260, 
	existingFilesFound:262, 
	overwrite:263, 
	skip:264, 
	rename:6, 
	UploadLimitsTitle:281, 
	UploadLimitsSizePerFile:282, 
	UploadLimitsTotalSize:283, 
	UploadLimitsFilesNumber:284,
	
	UploaderOptionsLabel:312,
	UploaderLimitLabel:281,
	AutoUploadLabel:311,
	CloseText:86,
	OptionsText:310
};
*/

document.write('<applet name="jumpLoaderApplet" id="jumpLoaderApplet" \
						code="jmaster.jumploader.app.JumpLoaderApplet.class" \
						archive="plugins/uploader.jumploader/jumploader_z.jar" \
						width="600" \
						height="400" \
						mayscript> \
					<param name="gc_loggingLevel" value="ERROR"/> \
					<param name="uc_uploadUrl" value="'+ document.location.href.split("?").shift() + '?secure_token=' + parent.Connexion.SECURE_TOKEN  +'&get_action=upload"/> \
					<param name="uc_resumeCheckUrl" value="'+ document.location.href.split("?").shift() + '?secure_token=' + parent.Connexion.SECURE_TOKEN  +'&get_action=upload"/> \
					<param name="uc_fileParameterName" value="userfile_0"/> \
					<param name="ac_fireUploaderStatusChanged" value="true"/> \
					<param name="ac_fireAppletInitialized" value="true"/> \
					<param name="uc_preserveRelativePath" value="true"/> \
					<param name="uc_directoriesEnabled" value="true"/> \
					<param name="ac_mode" value="FRAMED"/> \
					<param name="uc_ignoreFileAddErrors" value="false"/> \
					<param name="uc_urlEncodeParameters" value="true"/> \
				</applet>');
</script>
</body>
</html>
